// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

impl gaxi::prost::ToProto<PendingRenameInfo> for crate::generated::gapic_control::model::PendingRenameInfo {
    type Output = PendingRenameInfo;
    fn to_proto(self) -> std::result::Result<PendingRenameInfo, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            operation: self.operation.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::PendingRenameInfo> for PendingRenameInfo {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::PendingRenameInfo, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::PendingRenameInfo::new()
                .set_operation(self.operation)
        )
    }
}

impl gaxi::prost::ToProto<Folder> for crate::generated::gapic_control::model::Folder {
    type Output = Folder;
    fn to_proto(self) -> std::result::Result<Folder, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
            metageneration: self.metageneration.to_proto()?,
            create_time: self.create_time.map(|v| v.to_proto()).transpose()?,
            update_time: self.update_time.map(|v| v.to_proto()).transpose()?,
            pending_rename_info: self.pending_rename_info.map(|v| v.to_proto()).transpose()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::Folder> for Folder {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::Folder, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::Folder::new()
                .set_name(self.name)
                .set_metageneration(self.metageneration)
                .set_or_clear_create_time(self.create_time.map(|v| v.cnv()).transpose()?)
                .set_or_clear_update_time(self.update_time.map(|v| v.cnv()).transpose()?)
                .set_or_clear_pending_rename_info(self.pending_rename_info.map(|v| v.cnv()).transpose()?)
        )
    }
}

impl gaxi::prost::ToProto<GetFolderRequest> for crate::generated::gapic_control::model::GetFolderRequest {
    type Output = GetFolderRequest;
    fn to_proto(self) -> std::result::Result<GetFolderRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
            if_metageneration_match: self.if_metageneration_match.map(|v| v.to_proto()).transpose()?,
            if_metageneration_not_match: self.if_metageneration_not_match.map(|v| v.to_proto()).transpose()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::GetFolderRequest> for GetFolderRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::GetFolderRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::GetFolderRequest::new()
                .set_name(self.name)
                .set_or_clear_if_metageneration_match(self.if_metageneration_match.map(|v| v.cnv()).transpose()?)
                .set_or_clear_if_metageneration_not_match(self.if_metageneration_not_match.map(|v| v.cnv()).transpose()?)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<CreateFolderRequest> for crate::generated::gapic_control::model::CreateFolderRequest {
    type Output = CreateFolderRequest;
    fn to_proto(self) -> std::result::Result<CreateFolderRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            parent: self.parent.to_proto()?,
            folder: self.folder.map(|v| v.to_proto()).transpose()?,
            folder_id: self.folder_id.to_proto()?,
            recursive: self.recursive.to_proto()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::CreateFolderRequest> for CreateFolderRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::CreateFolderRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::CreateFolderRequest::new()
                .set_parent(self.parent)
                .set_or_clear_folder(self.folder.map(|v| v.cnv()).transpose()?)
                .set_folder_id(self.folder_id)
                .set_recursive(self.recursive)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<DeleteFolderRequest> for crate::generated::gapic_control::model::DeleteFolderRequest {
    type Output = DeleteFolderRequest;
    fn to_proto(self) -> std::result::Result<DeleteFolderRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
            if_metageneration_match: self.if_metageneration_match.map(|v| v.to_proto()).transpose()?,
            if_metageneration_not_match: self.if_metageneration_not_match.map(|v| v.to_proto()).transpose()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::DeleteFolderRequest> for DeleteFolderRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::DeleteFolderRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::DeleteFolderRequest::new()
                .set_name(self.name)
                .set_or_clear_if_metageneration_match(self.if_metageneration_match.map(|v| v.cnv()).transpose()?)
                .set_or_clear_if_metageneration_not_match(self.if_metageneration_not_match.map(|v| v.cnv()).transpose()?)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<ListFoldersRequest> for crate::generated::gapic_control::model::ListFoldersRequest {
    type Output = ListFoldersRequest;
    fn to_proto(self) -> std::result::Result<ListFoldersRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            parent: self.parent.to_proto()?,
            page_size: self.page_size.to_proto()?,
            page_token: self.page_token.to_proto()?,
            prefix: self.prefix.to_proto()?,
            delimiter: self.delimiter.to_proto()?,
            lexicographic_start: self.lexicographic_start.to_proto()?,
            lexicographic_end: self.lexicographic_end.to_proto()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::ListFoldersRequest> for ListFoldersRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::ListFoldersRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::ListFoldersRequest::new()
                .set_parent(self.parent)
                .set_page_size(self.page_size)
                .set_page_token(self.page_token)
                .set_prefix(self.prefix)
                .set_delimiter(self.delimiter)
                .set_lexicographic_start(self.lexicographic_start)
                .set_lexicographic_end(self.lexicographic_end)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<ListFoldersResponse> for crate::generated::gapic_control::model::ListFoldersResponse {
    type Output = ListFoldersResponse;
    fn to_proto(self) -> std::result::Result<ListFoldersResponse, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            folders: self.folders
                .into_iter()
                .map(|v| v.to_proto())
                .collect::<std::result::Result<std::vec::Vec<_>, _>>()?,
            next_page_token: self.next_page_token.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::ListFoldersResponse> for ListFoldersResponse {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::ListFoldersResponse, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::ListFoldersResponse::new()
                .set_folders(self.folders.into_iter().map(|v| v.cnv())
                    .collect::<std::result::Result<std::vec::Vec<_>, _>>()?)
                .set_next_page_token(self.next_page_token)
        )
    }
}

impl gaxi::prost::ToProto<RenameFolderRequest> for crate::generated::gapic_control::model::RenameFolderRequest {
    type Output = RenameFolderRequest;
    fn to_proto(self) -> std::result::Result<RenameFolderRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
            destination_folder_id: self.destination_folder_id.to_proto()?,
            if_metageneration_match: self.if_metageneration_match.map(|v| v.to_proto()).transpose()?,
            if_metageneration_not_match: self.if_metageneration_not_match.map(|v| v.to_proto()).transpose()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::RenameFolderRequest> for RenameFolderRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::RenameFolderRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::RenameFolderRequest::new()
                .set_name(self.name)
                .set_destination_folder_id(self.destination_folder_id)
                .set_or_clear_if_metageneration_match(self.if_metageneration_match.map(|v| v.cnv()).transpose()?)
                .set_or_clear_if_metageneration_not_match(self.if_metageneration_not_match.map(|v| v.cnv()).transpose()?)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<CommonLongRunningOperationMetadata> for crate::generated::gapic_control::model::CommonLongRunningOperationMetadata {
    type Output = CommonLongRunningOperationMetadata;
    fn to_proto(self) -> std::result::Result<CommonLongRunningOperationMetadata, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            create_time: self.create_time.map(|v| v.to_proto()).transpose()?,
            end_time: self.end_time.map(|v| v.to_proto()).transpose()?,
            update_time: self.update_time.map(|v| v.to_proto()).transpose()?,
            r#type: self.r#type.to_proto()?,
            requested_cancellation: self.requested_cancellation.to_proto()?,
            progress_percent: self.progress_percent.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::CommonLongRunningOperationMetadata> for CommonLongRunningOperationMetadata {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::CommonLongRunningOperationMetadata, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::CommonLongRunningOperationMetadata::new()
                .set_or_clear_create_time(self.create_time.map(|v| v.cnv()).transpose()?)
                .set_or_clear_end_time(self.end_time.map(|v| v.cnv()).transpose()?)
                .set_or_clear_update_time(self.update_time.map(|v| v.cnv()).transpose()?)
                .set_type(self.r#type)
                .set_requested_cancellation(self.requested_cancellation)
                .set_progress_percent(self.progress_percent)
        )
    }
}

impl gaxi::prost::ToProto<RenameFolderMetadata> for crate::generated::gapic_control::model::RenameFolderMetadata {
    type Output = RenameFolderMetadata;
    fn to_proto(self) -> std::result::Result<RenameFolderMetadata, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            common_metadata: self.common_metadata.map(|v| v.to_proto()).transpose()?,
            source_folder_id: self.source_folder_id.to_proto()?,
            destination_folder_id: self.destination_folder_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::RenameFolderMetadata> for RenameFolderMetadata {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::RenameFolderMetadata, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::RenameFolderMetadata::new()
                .set_or_clear_common_metadata(self.common_metadata.map(|v| v.cnv()).transpose()?)
                .set_source_folder_id(self.source_folder_id)
                .set_destination_folder_id(self.destination_folder_id)
        )
    }
}

impl gaxi::prost::ToProto<storage_layout::CustomPlacementConfig> for crate::generated::gapic_control::model::storage_layout::CustomPlacementConfig {
    type Output = storage_layout::CustomPlacementConfig;
    fn to_proto(self) -> std::result::Result<storage_layout::CustomPlacementConfig, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            data_locations: self.data_locations
                .into_iter()
                .map(|v| v.to_proto())
                .collect::<std::result::Result<std::vec::Vec<_>, _>>()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::storage_layout::CustomPlacementConfig> for storage_layout::CustomPlacementConfig {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::storage_layout::CustomPlacementConfig, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::storage_layout::CustomPlacementConfig::new()
                .set_data_locations(self.data_locations.into_iter().map(|v| v.cnv())
                    .collect::<std::result::Result<std::vec::Vec<_>, _>>()?)
        )
    }
}

impl gaxi::prost::ToProto<storage_layout::HierarchicalNamespace> for crate::generated::gapic_control::model::storage_layout::HierarchicalNamespace {
    type Output = storage_layout::HierarchicalNamespace;
    fn to_proto(self) -> std::result::Result<storage_layout::HierarchicalNamespace, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            enabled: self.enabled.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::storage_layout::HierarchicalNamespace> for storage_layout::HierarchicalNamespace {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::storage_layout::HierarchicalNamespace, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::storage_layout::HierarchicalNamespace::new()
                .set_enabled(self.enabled)
        )
    }
}

impl gaxi::prost::ToProto<StorageLayout> for crate::generated::gapic_control::model::StorageLayout {
    type Output = StorageLayout;
    fn to_proto(self) -> std::result::Result<StorageLayout, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
            location: self.location.to_proto()?,
            location_type: self.location_type.to_proto()?,
            custom_placement_config: self.custom_placement_config.map(|v| v.to_proto()).transpose()?,
            hierarchical_namespace: self.hierarchical_namespace.map(|v| v.to_proto()).transpose()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::StorageLayout> for StorageLayout {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::StorageLayout, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::StorageLayout::new()
                .set_name(self.name)
                .set_location(self.location)
                .set_location_type(self.location_type)
                .set_or_clear_custom_placement_config(self.custom_placement_config.map(|v| v.cnv()).transpose()?)
                .set_or_clear_hierarchical_namespace(self.hierarchical_namespace.map(|v| v.cnv()).transpose()?)
        )
    }
}

impl gaxi::prost::ToProto<GetStorageLayoutRequest> for crate::generated::gapic_control::model::GetStorageLayoutRequest {
    type Output = GetStorageLayoutRequest;
    fn to_proto(self) -> std::result::Result<GetStorageLayoutRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
            prefix: self.prefix.to_proto()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::GetStorageLayoutRequest> for GetStorageLayoutRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::GetStorageLayoutRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::GetStorageLayoutRequest::new()
                .set_name(self.name)
                .set_prefix(self.prefix)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<ManagedFolder> for crate::generated::gapic_control::model::ManagedFolder {
    type Output = ManagedFolder;
    fn to_proto(self) -> std::result::Result<ManagedFolder, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
            metageneration: self.metageneration.to_proto()?,
            create_time: self.create_time.map(|v| v.to_proto()).transpose()?,
            update_time: self.update_time.map(|v| v.to_proto()).transpose()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::ManagedFolder> for ManagedFolder {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::ManagedFolder, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::ManagedFolder::new()
                .set_name(self.name)
                .set_metageneration(self.metageneration)
                .set_or_clear_create_time(self.create_time.map(|v| v.cnv()).transpose()?)
                .set_or_clear_update_time(self.update_time.map(|v| v.cnv()).transpose()?)
        )
    }
}

impl gaxi::prost::ToProto<GetManagedFolderRequest> for crate::generated::gapic_control::model::GetManagedFolderRequest {
    type Output = GetManagedFolderRequest;
    fn to_proto(self) -> std::result::Result<GetManagedFolderRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
            if_metageneration_match: self.if_metageneration_match.map(|v| v.to_proto()).transpose()?,
            if_metageneration_not_match: self.if_metageneration_not_match.map(|v| v.to_proto()).transpose()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::GetManagedFolderRequest> for GetManagedFolderRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::GetManagedFolderRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::GetManagedFolderRequest::new()
                .set_name(self.name)
                .set_or_clear_if_metageneration_match(self.if_metageneration_match.map(|v| v.cnv()).transpose()?)
                .set_or_clear_if_metageneration_not_match(self.if_metageneration_not_match.map(|v| v.cnv()).transpose()?)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<CreateManagedFolderRequest> for crate::generated::gapic_control::model::CreateManagedFolderRequest {
    type Output = CreateManagedFolderRequest;
    fn to_proto(self) -> std::result::Result<CreateManagedFolderRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            parent: self.parent.to_proto()?,
            managed_folder: self.managed_folder.map(|v| v.to_proto()).transpose()?,
            managed_folder_id: self.managed_folder_id.to_proto()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::CreateManagedFolderRequest> for CreateManagedFolderRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::CreateManagedFolderRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::CreateManagedFolderRequest::new()
                .set_parent(self.parent)
                .set_or_clear_managed_folder(self.managed_folder.map(|v| v.cnv()).transpose()?)
                .set_managed_folder_id(self.managed_folder_id)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<DeleteManagedFolderRequest> for crate::generated::gapic_control::model::DeleteManagedFolderRequest {
    type Output = DeleteManagedFolderRequest;
    fn to_proto(self) -> std::result::Result<DeleteManagedFolderRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
            if_metageneration_match: self.if_metageneration_match.map(|v| v.to_proto()).transpose()?,
            if_metageneration_not_match: self.if_metageneration_not_match.map(|v| v.to_proto()).transpose()?,
            allow_non_empty: self.allow_non_empty.to_proto()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::DeleteManagedFolderRequest> for DeleteManagedFolderRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::DeleteManagedFolderRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::DeleteManagedFolderRequest::new()
                .set_name(self.name)
                .set_or_clear_if_metageneration_match(self.if_metageneration_match.map(|v| v.cnv()).transpose()?)
                .set_or_clear_if_metageneration_not_match(self.if_metageneration_not_match.map(|v| v.cnv()).transpose()?)
                .set_allow_non_empty(self.allow_non_empty)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<ListManagedFoldersRequest> for crate::generated::gapic_control::model::ListManagedFoldersRequest {
    type Output = ListManagedFoldersRequest;
    fn to_proto(self) -> std::result::Result<ListManagedFoldersRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            parent: self.parent.to_proto()?,
            page_size: self.page_size.to_proto()?,
            page_token: self.page_token.to_proto()?,
            prefix: self.prefix.to_proto()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::ListManagedFoldersRequest> for ListManagedFoldersRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::ListManagedFoldersRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::ListManagedFoldersRequest::new()
                .set_parent(self.parent)
                .set_page_size(self.page_size)
                .set_page_token(self.page_token)
                .set_prefix(self.prefix)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<ListManagedFoldersResponse> for crate::generated::gapic_control::model::ListManagedFoldersResponse {
    type Output = ListManagedFoldersResponse;
    fn to_proto(self) -> std::result::Result<ListManagedFoldersResponse, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            managed_folders: self.managed_folders
                .into_iter()
                .map(|v| v.to_proto())
                .collect::<std::result::Result<std::vec::Vec<_>, _>>()?,
            next_page_token: self.next_page_token.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::ListManagedFoldersResponse> for ListManagedFoldersResponse {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::ListManagedFoldersResponse, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::ListManagedFoldersResponse::new()
                .set_managed_folders(self.managed_folders.into_iter().map(|v| v.cnv())
                    .collect::<std::result::Result<std::vec::Vec<_>, _>>()?)
                .set_next_page_token(self.next_page_token)
        )
    }
}

impl gaxi::prost::ToProto<CreateAnywhereCacheMetadata> for crate::generated::gapic_control::model::CreateAnywhereCacheMetadata {
    type Output = CreateAnywhereCacheMetadata;
    fn to_proto(self) -> std::result::Result<CreateAnywhereCacheMetadata, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            common_metadata: self.common_metadata.map(|v| v.to_proto()).transpose()?,
            anywhere_cache_id: self.anywhere_cache_id.map(|v| v.to_proto()).transpose()?,
            zone: self.zone.map(|v| v.to_proto()).transpose()?,
            ttl: self.ttl.map(|v| v.to_proto()).transpose()?,
            admission_policy: self.admission_policy.map(|v| v.to_proto()).transpose()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::CreateAnywhereCacheMetadata> for CreateAnywhereCacheMetadata {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::CreateAnywhereCacheMetadata, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::CreateAnywhereCacheMetadata::new()
                .set_or_clear_common_metadata(self.common_metadata.map(|v| v.cnv()).transpose()?)
                .set_or_clear_anywhere_cache_id(self.anywhere_cache_id.map(|v| v.cnv()).transpose()?)
                .set_or_clear_zone(self.zone.map(|v| v.cnv()).transpose()?)
                .set_or_clear_ttl(self.ttl.map(|v| v.cnv()).transpose()?)
                .set_or_clear_admission_policy(self.admission_policy.map(|v| v.cnv()).transpose()?)
        )
    }
}

impl gaxi::prost::ToProto<UpdateAnywhereCacheMetadata> for crate::generated::gapic_control::model::UpdateAnywhereCacheMetadata {
    type Output = UpdateAnywhereCacheMetadata;
    fn to_proto(self) -> std::result::Result<UpdateAnywhereCacheMetadata, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            common_metadata: self.common_metadata.map(|v| v.to_proto()).transpose()?,
            anywhere_cache_id: self.anywhere_cache_id.map(|v| v.to_proto()).transpose()?,
            zone: self.zone.map(|v| v.to_proto()).transpose()?,
            ttl: self.ttl.map(|v| v.to_proto()).transpose()?,
            admission_policy: self.admission_policy.map(|v| v.to_proto()).transpose()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::UpdateAnywhereCacheMetadata> for UpdateAnywhereCacheMetadata {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::UpdateAnywhereCacheMetadata, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::UpdateAnywhereCacheMetadata::new()
                .set_or_clear_common_metadata(self.common_metadata.map(|v| v.cnv()).transpose()?)
                .set_or_clear_anywhere_cache_id(self.anywhere_cache_id.map(|v| v.cnv()).transpose()?)
                .set_or_clear_zone(self.zone.map(|v| v.cnv()).transpose()?)
                .set_or_clear_ttl(self.ttl.map(|v| v.cnv()).transpose()?)
                .set_or_clear_admission_policy(self.admission_policy.map(|v| v.cnv()).transpose()?)
        )
    }
}

impl gaxi::prost::ToProto<AnywhereCache> for crate::generated::gapic_control::model::AnywhereCache {
    type Output = AnywhereCache;
    fn to_proto(self) -> std::result::Result<AnywhereCache, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
            zone: self.zone.to_proto()?,
            ttl: self.ttl.map(|v| v.to_proto()).transpose()?,
            admission_policy: self.admission_policy.to_proto()?,
            state: self.state.to_proto()?,
            create_time: self.create_time.map(|v| v.to_proto()).transpose()?,
            update_time: self.update_time.map(|v| v.to_proto()).transpose()?,
            pending_update: self.pending_update.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::AnywhereCache> for AnywhereCache {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::AnywhereCache, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::AnywhereCache::new()
                .set_name(self.name)
                .set_zone(self.zone)
                .set_or_clear_ttl(self.ttl.map(|v| v.cnv()).transpose()?)
                .set_admission_policy(self.admission_policy)
                .set_state(self.state)
                .set_or_clear_create_time(self.create_time.map(|v| v.cnv()).transpose()?)
                .set_or_clear_update_time(self.update_time.map(|v| v.cnv()).transpose()?)
                .set_pending_update(self.pending_update)
        )
    }
}

impl gaxi::prost::ToProto<CreateAnywhereCacheRequest> for crate::generated::gapic_control::model::CreateAnywhereCacheRequest {
    type Output = CreateAnywhereCacheRequest;
    fn to_proto(self) -> std::result::Result<CreateAnywhereCacheRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            parent: self.parent.to_proto()?,
            anywhere_cache: self.anywhere_cache.map(|v| v.to_proto()).transpose()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::CreateAnywhereCacheRequest> for CreateAnywhereCacheRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::CreateAnywhereCacheRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::CreateAnywhereCacheRequest::new()
                .set_parent(self.parent)
                .set_or_clear_anywhere_cache(self.anywhere_cache.map(|v| v.cnv()).transpose()?)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<UpdateAnywhereCacheRequest> for crate::generated::gapic_control::model::UpdateAnywhereCacheRequest {
    type Output = UpdateAnywhereCacheRequest;
    fn to_proto(self) -> std::result::Result<UpdateAnywhereCacheRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            anywhere_cache: self.anywhere_cache.map(|v| v.to_proto()).transpose()?,
            update_mask: self.update_mask.map(|v| v.to_proto()).transpose()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::UpdateAnywhereCacheRequest> for UpdateAnywhereCacheRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::UpdateAnywhereCacheRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::UpdateAnywhereCacheRequest::new()
                .set_or_clear_anywhere_cache(self.anywhere_cache.map(|v| v.cnv()).transpose()?)
                .set_or_clear_update_mask(self.update_mask.map(|v| v.cnv()).transpose()?)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<DisableAnywhereCacheRequest> for crate::generated::gapic_control::model::DisableAnywhereCacheRequest {
    type Output = DisableAnywhereCacheRequest;
    fn to_proto(self) -> std::result::Result<DisableAnywhereCacheRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::DisableAnywhereCacheRequest> for DisableAnywhereCacheRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::DisableAnywhereCacheRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::DisableAnywhereCacheRequest::new()
                .set_name(self.name)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<PauseAnywhereCacheRequest> for crate::generated::gapic_control::model::PauseAnywhereCacheRequest {
    type Output = PauseAnywhereCacheRequest;
    fn to_proto(self) -> std::result::Result<PauseAnywhereCacheRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::PauseAnywhereCacheRequest> for PauseAnywhereCacheRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::PauseAnywhereCacheRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::PauseAnywhereCacheRequest::new()
                .set_name(self.name)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<ResumeAnywhereCacheRequest> for crate::generated::gapic_control::model::ResumeAnywhereCacheRequest {
    type Output = ResumeAnywhereCacheRequest;
    fn to_proto(self) -> std::result::Result<ResumeAnywhereCacheRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::ResumeAnywhereCacheRequest> for ResumeAnywhereCacheRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::ResumeAnywhereCacheRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::ResumeAnywhereCacheRequest::new()
                .set_name(self.name)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<GetAnywhereCacheRequest> for crate::generated::gapic_control::model::GetAnywhereCacheRequest {
    type Output = GetAnywhereCacheRequest;
    fn to_proto(self) -> std::result::Result<GetAnywhereCacheRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::GetAnywhereCacheRequest> for GetAnywhereCacheRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::GetAnywhereCacheRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::GetAnywhereCacheRequest::new()
                .set_name(self.name)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<ListAnywhereCachesRequest> for crate::generated::gapic_control::model::ListAnywhereCachesRequest {
    type Output = ListAnywhereCachesRequest;
    fn to_proto(self) -> std::result::Result<ListAnywhereCachesRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            parent: self.parent.to_proto()?,
            page_size: self.page_size.to_proto()?,
            page_token: self.page_token.to_proto()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::ListAnywhereCachesRequest> for ListAnywhereCachesRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::ListAnywhereCachesRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::ListAnywhereCachesRequest::new()
                .set_parent(self.parent)
                .set_page_size(self.page_size)
                .set_page_token(self.page_token)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<ListAnywhereCachesResponse> for crate::generated::gapic_control::model::ListAnywhereCachesResponse {
    type Output = ListAnywhereCachesResponse;
    fn to_proto(self) -> std::result::Result<ListAnywhereCachesResponse, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            anywhere_caches: self.anywhere_caches
                .into_iter()
                .map(|v| v.to_proto())
                .collect::<std::result::Result<std::vec::Vec<_>, _>>()?,
            next_page_token: self.next_page_token.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::ListAnywhereCachesResponse> for ListAnywhereCachesResponse {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::ListAnywhereCachesResponse, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::ListAnywhereCachesResponse::new()
                .set_anywhere_caches(self.anywhere_caches.into_iter().map(|v| v.cnv())
                    .collect::<std::result::Result<std::vec::Vec<_>, _>>()?)
                .set_next_page_token(self.next_page_token)
        )
    }
}

impl gaxi::prost::ToProto<intelligence_config::filter::CloudStorageLocations> for crate::generated::gapic_control::model::intelligence_config::filter::CloudStorageLocations {
    type Output = intelligence_config::filter::CloudStorageLocations;
    fn to_proto(self) -> std::result::Result<intelligence_config::filter::CloudStorageLocations, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            locations: self.locations
                .into_iter()
                .map(|v| v.to_proto())
                .collect::<std::result::Result<std::vec::Vec<_>, _>>()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::intelligence_config::filter::CloudStorageLocations> for intelligence_config::filter::CloudStorageLocations {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::intelligence_config::filter::CloudStorageLocations, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::intelligence_config::filter::CloudStorageLocations::new()
                .set_locations(self.locations.into_iter().map(|v| v.cnv())
                    .collect::<std::result::Result<std::vec::Vec<_>, _>>()?)
        )
    }
}

impl gaxi::prost::ToProto<intelligence_config::filter::CloudStorageBuckets> for crate::generated::gapic_control::model::intelligence_config::filter::CloudStorageBuckets {
    type Output = intelligence_config::filter::CloudStorageBuckets;
    fn to_proto(self) -> std::result::Result<intelligence_config::filter::CloudStorageBuckets, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            bucket_id_regexes: self.bucket_id_regexes
                .into_iter()
                .map(|v| v.to_proto())
                .collect::<std::result::Result<std::vec::Vec<_>, _>>()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::intelligence_config::filter::CloudStorageBuckets> for intelligence_config::filter::CloudStorageBuckets {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::intelligence_config::filter::CloudStorageBuckets, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::intelligence_config::filter::CloudStorageBuckets::new()
                .set_bucket_id_regexes(self.bucket_id_regexes.into_iter().map(|v| v.cnv())
                    .collect::<std::result::Result<std::vec::Vec<_>, _>>()?)
        )
    }
}

impl gaxi::prost::ToProto<intelligence_config::filter::CloudStorageLocationsOneOf> for crate::generated::gapic_control::model::intelligence_config::filter::CloudStorageLocationsOneOf {
    type Output = intelligence_config::filter::CloudStorageLocationsOneOf;
    fn to_proto(self) -> std::result::Result<Self::Output, gaxi::prost::ConvertError> {
        match self {
            Self::IncludedCloudStorageLocations(v) => Ok(Self::Output::IncludedCloudStorageLocations((*v).to_proto()?)),
            Self::ExcludedCloudStorageLocations(v) => Ok(Self::Output::ExcludedCloudStorageLocations((*v).to_proto()?)),
        }
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::intelligence_config::filter::CloudStorageLocationsOneOf> for intelligence_config::filter::CloudStorageLocationsOneOf {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::intelligence_config::filter::CloudStorageLocationsOneOf, gaxi::prost::ConvertError> {
        use crate::generated::gapic_control::model::intelligence_config::filter::CloudStorageLocationsOneOf as T;
        match self {
            Self::IncludedCloudStorageLocations(v) => Ok(T::from_included_cloud_storage_locations(v.cnv()?)),
            Self::ExcludedCloudStorageLocations(v) => Ok(T::from_excluded_cloud_storage_locations(v.cnv()?)),
        }
    }
}

impl gaxi::prost::ToProto<intelligence_config::filter::CloudStorageBucketsOneOf> for crate::generated::gapic_control::model::intelligence_config::filter::CloudStorageBucketsOneOf {
    type Output = intelligence_config::filter::CloudStorageBucketsOneOf;
    fn to_proto(self) -> std::result::Result<Self::Output, gaxi::prost::ConvertError> {
        match self {
            Self::IncludedCloudStorageBuckets(v) => Ok(Self::Output::IncludedCloudStorageBuckets((*v).to_proto()?)),
            Self::ExcludedCloudStorageBuckets(v) => Ok(Self::Output::ExcludedCloudStorageBuckets((*v).to_proto()?)),
        }
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::intelligence_config::filter::CloudStorageBucketsOneOf> for intelligence_config::filter::CloudStorageBucketsOneOf {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::intelligence_config::filter::CloudStorageBucketsOneOf, gaxi::prost::ConvertError> {
        use crate::generated::gapic_control::model::intelligence_config::filter::CloudStorageBucketsOneOf as T;
        match self {
            Self::IncludedCloudStorageBuckets(v) => Ok(T::from_included_cloud_storage_buckets(v.cnv()?)),
            Self::ExcludedCloudStorageBuckets(v) => Ok(T::from_excluded_cloud_storage_buckets(v.cnv()?)),
        }
    }
}

impl gaxi::prost::ToProto<intelligence_config::Filter> for crate::generated::gapic_control::model::intelligence_config::Filter {
    type Output = intelligence_config::Filter;
    fn to_proto(self) -> std::result::Result<intelligence_config::Filter, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            cloud_storage_locations: self.cloud_storage_locations.map(|v| v.to_proto()).transpose()?,
            cloud_storage_buckets: self.cloud_storage_buckets.map(|v| v.to_proto()).transpose()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::intelligence_config::Filter> for intelligence_config::Filter {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::intelligence_config::Filter, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::intelligence_config::Filter::new()
                .set_cloud_storage_locations(self.cloud_storage_locations.map(|v| v.cnv()).transpose()?)
                .set_cloud_storage_buckets(self.cloud_storage_buckets.map(|v| v.cnv()).transpose()?)
        )
    }
}

impl gaxi::prost::ToProto<intelligence_config::effective_intelligence_config::EffectiveEdition> for crate::generated::gapic_control::model::intelligence_config::effective_intelligence_config::EffectiveEdition {
    type Output = i32;
    fn to_proto(self) -> std::result::Result<Self::Output, gaxi::prost::ConvertError> {
        self.value().ok_or(gaxi::prost::ConvertError::EnumNoIntegerValue("crate::generated::gapic_control::model::intelligence_config::effective_intelligence_config::EffectiveEdition"))
    }
}

impl gaxi::prost::ToProto<intelligence_config::EffectiveIntelligenceConfig> for crate::generated::gapic_control::model::intelligence_config::EffectiveIntelligenceConfig {
    type Output = intelligence_config::EffectiveIntelligenceConfig;
    fn to_proto(self) -> std::result::Result<intelligence_config::EffectiveIntelligenceConfig, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            effective_edition: self.effective_edition.to_proto()?,
            intelligence_config: self.intelligence_config.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::intelligence_config::EffectiveIntelligenceConfig> for intelligence_config::EffectiveIntelligenceConfig {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::intelligence_config::EffectiveIntelligenceConfig, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::intelligence_config::EffectiveIntelligenceConfig::new()
                .set_effective_edition(self.effective_edition)
                .set_intelligence_config(self.intelligence_config)
        )
    }
}

impl gaxi::prost::ToProto<intelligence_config::TrialConfig> for crate::generated::gapic_control::model::intelligence_config::TrialConfig {
    type Output = intelligence_config::TrialConfig;
    fn to_proto(self) -> std::result::Result<intelligence_config::TrialConfig, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            expire_time: self.expire_time.map(|v| v.to_proto()).transpose()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::intelligence_config::TrialConfig> for intelligence_config::TrialConfig {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::intelligence_config::TrialConfig, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::intelligence_config::TrialConfig::new()
                .set_or_clear_expire_time(self.expire_time.map(|v| v.cnv()).transpose()?)
        )
    }
}

impl gaxi::prost::ToProto<intelligence_config::EditionConfig> for crate::generated::gapic_control::model::intelligence_config::EditionConfig {
    type Output = i32;
    fn to_proto(self) -> std::result::Result<Self::Output, gaxi::prost::ConvertError> {
        self.value().ok_or(gaxi::prost::ConvertError::EnumNoIntegerValue("crate::generated::gapic_control::model::intelligence_config::EditionConfig"))
    }
}

impl gaxi::prost::ToProto<IntelligenceConfig> for crate::generated::gapic_control::model::IntelligenceConfig {
    type Output = IntelligenceConfig;
    fn to_proto(self) -> std::result::Result<IntelligenceConfig, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
            edition_config: self.edition_config.to_proto()?,
            update_time: self.update_time.map(|v| v.to_proto()).transpose()?,
            filter: self.filter.map(|v| v.to_proto()).transpose()?,
            effective_intelligence_config: self.effective_intelligence_config.map(|v| v.to_proto()).transpose()?,
            trial_config: self.trial_config.map(|v| v.to_proto()).transpose()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::IntelligenceConfig> for IntelligenceConfig {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::IntelligenceConfig, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::IntelligenceConfig::new()
                .set_name(self.name)
                .set_edition_config(self.edition_config)
                .set_or_clear_update_time(self.update_time.map(|v| v.cnv()).transpose()?)
                .set_or_clear_filter(self.filter.map(|v| v.cnv()).transpose()?)
                .set_or_clear_effective_intelligence_config(self.effective_intelligence_config.map(|v| v.cnv()).transpose()?)
                .set_or_clear_trial_config(self.trial_config.map(|v| v.cnv()).transpose()?)
        )
    }
}

impl gaxi::prost::ToProto<UpdateOrganizationIntelligenceConfigRequest> for crate::generated::gapic_control::model::UpdateOrganizationIntelligenceConfigRequest {
    type Output = UpdateOrganizationIntelligenceConfigRequest;
    fn to_proto(self) -> std::result::Result<UpdateOrganizationIntelligenceConfigRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            intelligence_config: self.intelligence_config.map(|v| v.to_proto()).transpose()?,
            update_mask: self.update_mask.map(|v| v.to_proto()).transpose()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::UpdateOrganizationIntelligenceConfigRequest> for UpdateOrganizationIntelligenceConfigRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::UpdateOrganizationIntelligenceConfigRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::UpdateOrganizationIntelligenceConfigRequest::new()
                .set_or_clear_intelligence_config(self.intelligence_config.map(|v| v.cnv()).transpose()?)
                .set_or_clear_update_mask(self.update_mask.map(|v| v.cnv()).transpose()?)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<UpdateFolderIntelligenceConfigRequest> for crate::generated::gapic_control::model::UpdateFolderIntelligenceConfigRequest {
    type Output = UpdateFolderIntelligenceConfigRequest;
    fn to_proto(self) -> std::result::Result<UpdateFolderIntelligenceConfigRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            intelligence_config: self.intelligence_config.map(|v| v.to_proto()).transpose()?,
            update_mask: self.update_mask.map(|v| v.to_proto()).transpose()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::UpdateFolderIntelligenceConfigRequest> for UpdateFolderIntelligenceConfigRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::UpdateFolderIntelligenceConfigRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::UpdateFolderIntelligenceConfigRequest::new()
                .set_or_clear_intelligence_config(self.intelligence_config.map(|v| v.cnv()).transpose()?)
                .set_or_clear_update_mask(self.update_mask.map(|v| v.cnv()).transpose()?)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<UpdateProjectIntelligenceConfigRequest> for crate::generated::gapic_control::model::UpdateProjectIntelligenceConfigRequest {
    type Output = UpdateProjectIntelligenceConfigRequest;
    fn to_proto(self) -> std::result::Result<UpdateProjectIntelligenceConfigRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            intelligence_config: self.intelligence_config.map(|v| v.to_proto()).transpose()?,
            update_mask: self.update_mask.map(|v| v.to_proto()).transpose()?,
            request_id: self.request_id.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::UpdateProjectIntelligenceConfigRequest> for UpdateProjectIntelligenceConfigRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::UpdateProjectIntelligenceConfigRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::UpdateProjectIntelligenceConfigRequest::new()
                .set_or_clear_intelligence_config(self.intelligence_config.map(|v| v.cnv()).transpose()?)
                .set_or_clear_update_mask(self.update_mask.map(|v| v.cnv()).transpose()?)
                .set_request_id(self.request_id)
        )
    }
}

impl gaxi::prost::ToProto<GetOrganizationIntelligenceConfigRequest> for crate::generated::gapic_control::model::GetOrganizationIntelligenceConfigRequest {
    type Output = GetOrganizationIntelligenceConfigRequest;
    fn to_proto(self) -> std::result::Result<GetOrganizationIntelligenceConfigRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::GetOrganizationIntelligenceConfigRequest> for GetOrganizationIntelligenceConfigRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::GetOrganizationIntelligenceConfigRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::GetOrganizationIntelligenceConfigRequest::new()
                .set_name(self.name)
        )
    }
}

impl gaxi::prost::ToProto<GetFolderIntelligenceConfigRequest> for crate::generated::gapic_control::model::GetFolderIntelligenceConfigRequest {
    type Output = GetFolderIntelligenceConfigRequest;
    fn to_proto(self) -> std::result::Result<GetFolderIntelligenceConfigRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::GetFolderIntelligenceConfigRequest> for GetFolderIntelligenceConfigRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::GetFolderIntelligenceConfigRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::GetFolderIntelligenceConfigRequest::new()
                .set_name(self.name)
        )
    }
}

impl gaxi::prost::ToProto<GetProjectIntelligenceConfigRequest> for crate::generated::gapic_control::model::GetProjectIntelligenceConfigRequest {
    type Output = GetProjectIntelligenceConfigRequest;
    fn to_proto(self) -> std::result::Result<GetProjectIntelligenceConfigRequest, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            name: self.name.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<crate::generated::gapic_control::model::GetProjectIntelligenceConfigRequest> for GetProjectIntelligenceConfigRequest {
    fn cnv(self) -> std::result::Result<crate::generated::gapic_control::model::GetProjectIntelligenceConfigRequest, gaxi::prost::ConvertError> {
        Ok(
            crate::generated::gapic_control::model::GetProjectIntelligenceConfigRequest::new()
                .set_name(self.name)
        )
    }
}
